home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2149 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.8 KB

  1. Path: ibm1.eng.ohio-state.edu!xiaoyi
  2. From: xiaoyi@ibm1.eng.ohio-state.edu (Xiaoyi Wu)
  3. Newsgroups: comp.graphics.algorithms,comp.lang.c,sci.image.processing
  4. Subject: Re: 2D image rotation problem
  5. Date: 19 Jan 1996 14:38:14 GMT
  6. Organization: The Ohio State University
  7. Message-ID: <4doacm$27s@charm.magnus.acs.ohio-state.edu>
  8. References: <4de7gt$j0i@charm.magnus.acs.ohio-state.edu> <4dec11$jg5@charm.magnus.acs.ohio-state.edu> <DLAMGr.LEM@wave.scar.utoronto.ca>
  9. NNTP-Posting-Host: ibm1.eng.ohio-state.edu
  10.  
  11. Hi Kap, actually after a night's thought about it i figured it is
  12. impossible to do a rotation without creating holes unless the image is
  13. infintely large - of course you can kinda fix them by duplicating the
  14. closest pixels to the pixels that fall out of the source image. 
  15.  
  16. another option which seems to be the way you did it (at least the way i 
  17. interprete your response) is to ignore the pixels that need to be 
  18. reconstructed using non-existent pixels, and end up with a "rotated" 
  19. image that has blank strips in it.
  20.  
  21. for me, both would work 'cuz the object in my images are in the center so 
  22. i can afford to ignore the edges. but for other applications i guess i 
  23. still need to be educated.
  24.  
  25. the reverse rotation is just replacing your theta with -theta :) then 
  26. when you do the interpolation you will be working with pixel values you know.
  27.  
  28. thanks. 
  29.  
  30. Xiaoyi
  31.  
  32. On Tue, 16 Jan 1996, Kap Shiwram wrote:
  33. > Hmm, to keep it in the range of the source image, couldn't you use AND 
  34. > with your index?  Um, this is how I use to do it - the rotation failed 
  35. > but it was never out of the range of the source file. :)  Um, this is 
  36. > assuming you're using powers of 2 for the dimensions of your image of 
  37. > course; if you're not then you might have to suffer a divide (eeek) i.e. 
  38. > use the MOD of your index into the image and the dimensions multiplied.
  39. > Um, assuming your image dimensions are 32x32, 
  40. >    ; calculate the index [si] first
  41. >    and si, (32*32)-1
  42. >    lea si, [image+si]
  43. >    movsb
  44. > I'm curious though.. could you explain how you did the reverse rotation? 
  45. > I was thinking about this and doing landscapes or flags.  It always had 
  46. > holes in it since I was calculating the X and Y values to plot on screen 
  47. > but if I had just done a loop over the X and Y values then this would not 
  48. > have happened - instead, I would have just calculated the index into the 
  49. > image array and covered the entire area.  The problem is, I don't know 
  50. > how to get the reverse function.  Is it just the inverse?
  51.  
  52. Xiaoyi
  53.  
  54. /=======================================================================\
  55. | Xiaoyi Wu        || If you can't convince them, confuse them.         |
  56. | 614-421-0934 (h) ||  xiaoyi@mozart.bme.ohio-state.edu                    |
  57. | 614-292-1555 (o) ||  http://chopin.bme.ohio-state.edu/~xiaoyi/hi.html |
  58. \~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/
  59.  
  60.  
  61.  
  62.